<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

</body>
<script>
    // 1. 依次输出什么?
    // 2. 整个过程中产生了几个执行上下文?
    // [globalContext]
    console.log('global begin: ' + i)
    var i = 1
    foo(1);
    function foo(i) {
        if (i == 2) {
            return;
        }
        console.log('foo() begin:' + i);
        foo(i + 1);// foo(2)
        console.log('foo() end:' + i);// foo() end: 1
    }
    console.log('global end: ' + i);

    // 结果：
    // global begin: undefined
    // foo() begin:1
    // foo() end: 1
    // global end: : 1
</script>
</html>